package io.renren.modules.business.controller;

import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.modules.business.entity.EUserProjectRelEntity;
import io.renren.modules.business.service.EUserProjectRelService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 人员-项目关系表
 */
@RestController
@RequestMapping("business/euserprojectrel")
public class EUserProjectRelController {
    @Autowired
    private EUserProjectRelService eUserProjectRelService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = eUserProjectRelService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		EUserProjectRelEntity eUserProjectRel = eUserProjectRelService.getById(id);

        return R.ok().put("eUserProjectRel", eUserProjectRel);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody EUserProjectRelEntity eUserProjectRel){
		eUserProjectRelService.save(eUserProjectRel);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody EUserProjectRelEntity eUserProjectRel){
		eUserProjectRelService.updateById(eUserProjectRel);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		eUserProjectRelService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
